home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 24 / mset.zip / MSET.8 next >
Text File  |  1987-09-10  |  2KB  |  44 lines

  1. ;MSET.COM sets video mode.
  2.      mov  si,80h              ;Point to command line
  3.      mov  ax,0                ;Init old total on stack
  4.      push ax
  5.      lodsb                    ;Get # chars
  6.      mov  cl,al               ;to cl
  7.      mov  ch,0
  8. X0:  lodsb                    ;Skip spaces
  9.      cmp  al,' '              ;= space?
  10.      jne  X1                  ;No
  11.      loop X0                  ;Yes, skip them
  12. X1:  
  13.      cmp  cl,0                ;Any parameter?
  14.      je   Error               ;No
  15.      dec  si                  ;Yes, point to first char
  16. X2:  lodsb                    ;Get a char
  17.      cmp  al,13               ;Is a carriage return?
  18.      je   X3                  ;Yes
  19.      sub  al,'0'              ;Convert to number
  20.      cmp  al,0                ;<0?
  21.      jb   Error               ;Yes
  22.      cmp  al,9                ;>9?
  23.      ja   Error               ;Yes
  24.      mov  bl,al               ;Save in bl
  25.      pop  ax                  ;Get old total
  26.      mov  ah,10               ;x 10
  27.      mul  ah
  28.      add  al,bl               ;Add new value
  29.      push ax                  ;Save new total
  30.      loop X2                  ;Keep going until cr
  31. X3:  pop  ax                  ;Get total
  32.      cmp  al,16               ;>16?
  33.      ja   Error               ;Yes
  34.      mov  ah,0                ;Set mode
  35.      int  10h                 ;thru BIOS
  36. X4:  int  20h                 ;and quit
  37.  
  38. Msg: db   'Format is:  mset mode   where mode = 0 to 16',13,10,'$'
  39. Error:
  40.      mov  dx,Msg              ;Point to error message
  41.      mov  ah,9                ;Print to screen
  42.      int  21h                 ;thru DOS
  43.      jmp  X4                  ;and quit
  44.